﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NC.Infrastructure.Domain.News;
using NC.Infrastructure.DomainDto.Identity;

namespace NC.Infrastructure.Mapper
{
    public static class PersonMapper
    {
        /// <summary>
        /// Mapper申请人的详细信息
        /// </summary>
        /// <param name="applyQueryable"></param>
        /// <returns>返回某个人的详细信息</returns>
        public static IQueryable<ApplyPersonDto> MapToApplyPerson(this IQueryable<Apply> applyQueryable)
        {
            return applyQueryable.Select(n => new ApplyPersonDto()
            {
                Name = n.Person.Name,
                ApplyDescription = n.Description,
                Description = n.Person.Description,
                Image = n.Person.Image,
                InSchoolTime = n.Person.InSchoolTime,
                Password = n.Person.Password,
                Role = n.Person.Role,
                SchoolNumber = n.Person.SchoolNumber,
                TickName = n.Person.TickName
            });
        }

        /// <summary>
        /// Mapper申请人的列表信息
        /// </summary>
        /// <param name="applyQueryable"></param>
        /// <returns>返回所有申请人的列表信息</returns>
        public static IQueryable<ApplyPersonListDto> MapToApplyPersonListDtos(this IQueryable<Apply> applyQueryable)
        {
            return applyQueryable.Select(n => new ApplyPersonListDto()
            {
                Name = n.Person.Name,
                ApplyDescription = n.Description,
                Role = n.Person.Role,
                SchoolNumber = n.Person.SchoolNumber
            });
        }
    }
}
